package com.jcf.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jcf.springboot.entity.sys.SysRole;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author test
* @description 针对表【sys_role】的数据库操作Mapper
* @createDate 2023-04-30 22:39:42
* @Entity com.jcf.springboot.entity.sys.SysRole
*/
public interface SysRoleMapper extends BaseMapper<SysRole> {


  @Select(" select * from sys_role sr join sys_user_role sur on sr.id = sur.role_id where sur.user_id = #{userId}")
List<SysRole> getRoleByUserId(String userId);

  @Select("select role_id from sys_user_role ur where ur.user_id = #{userId}" )
  List<String> selectIdByUser(String userId);
}
